home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: Initialising structure members - help please!
- Date: 20 Feb 1996 07:53 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <20FEB199607530966@erich.triumf.ca>
- References: <4gb8hn$3m8@news.mistral.co.uk> <31298EF1.5F2C@cmt.lpr.mail.carel.fi> <4gckb1$77e@news.mistral.co.uk>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4gckb1$77e@news.mistral.co.uk>, mikebarnard@mistral.co.uk (Mike Barnard) writes...
- >You said...
- >
- >>>one.number = 1;
- >>>one.description = "1. Calculate a minefield";
- >
- >>You can't copy C strings with an "=". You must use the strcpy() function.
-
- >Thanks, I'll look at what this means. But as a learning question, (not
- >an argumentative one!!!), why does this good old boy work then?
- >
- >char name[]="An array of characters";
- >
- >Surely "name" is an array of characters as is my "description"? It
- >works here. Doesn't it? This leads me on to another question actually,
- >but I'll start another thread with it I think.
-
- You can do this to _initialize_ a char array when you first declare it.
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
-
-
-
-
-
-
-
-